package com.lianqi.emcpframework.logging.level.strategy;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

import com.lianqi.emcpframework.logging.context.InvokingLoggerContext;

/**
 * @program emcp-framework
 * @ClassName InfoLogStrategy
 * @description: error 级别日志输出
 * @author: sky
 * @create: 2019/05/10 14:44
 */
public class ErrorLogStrategy implements LogLevelStrategy {

    private static final List<String> excludeList = new ArrayList<>(Arrays.asList("requestHeaders", "response"));

    @Override
    public Map<String, Object> parse(InvokingLoggerContext context) {
        if (context.getException() == null) {
            return null;
        }
        return context.toSimpleMap(objectFilter(), excludeList);
    }
}
